package recharge

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/assets-api/internal/service/setting_config"
	"gitee.com/liuxuezhan/ar-platform/assets-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/assets-api/internal/types"
	"gitee.com/liuxuezhan/ar-platform/base-common/consts"
	"github.com/zeromicro/go-zero/core/logx"
)

type RechargeConfigLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 用户充值页面--显示配置
func NewRechargeConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RechargeConfigLogic {
	return &RechargeConfigLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RechargeConfigLogic) RechargeConfig(req *types.RechargeConfigRequest) (resp *types.RechargeConfigResponse, err error) {
	resp = &types.RechargeConfigResponse{
		OpenRechargeLocalWallet: int(consts.IntBoolDbFalse),
		OpenRechargeLocalBank:   int(consts.IntBoolDbFalse),
	}

	if setting_config.OpenRechargeLocalWallet(l.ctx, l.svcCtx.CommonSettingRpc) {
		resp.OpenRechargeLocalWallet = int(consts.IntBoolDbTrue)
	}

	if setting_config.OpenRechargeLocalBank(l.ctx, l.svcCtx.CommonSettingRpc) {
		resp.OpenRechargeLocalBank = int(consts.IntBoolDbTrue)
	}

	return
}
